const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const TerserWebpackPlugin =require('terser-webpack-plugin')
module.exports = {
    //需要被打包的js文件路径及文件名
    entry: './main.js',
    mode:'production',
    plugins: [
		new UglifyJsPlugin({
			uglifyOptions: {
				output: {
					comments: false // 去除注释
				},
				compress: {
					drop_debugger: false,
					drop_console: true,
				}
			}
		}),
        new TerserWebpackPlugin({
			parallel: true,
			extractComments: true,
			terserOptions: {
                output: { comments: false },
				ecma: undefined,
				warnings: false,
				parse: {},
				compress: {
					drop_console: true,
					drop_debugger: false,
					pure_funcs: ['console.log'] // 移除console
				}
			},
		})
	],
    output: {
        //打包输出的目标文件的绝对路径(其中__dirname为当前目录的绝对路径)
        path: __dirname + '/dist',  
        //打包输出的js文件名及相对于dist目录所在路径
        filename: 'easy.template.js'  
    }
};